/**
 * 
 *  @project Air Traff Monitor
 * 
 *  @author M.Emre ATASEVER <m.emre.atas@gmail.com>
 *  @author M.Burak ALKAN <mburakalkan@gmail.com>
 *  @author H.Burak KARAMIK <bkaramik@gmail.com>
 *
 *	`Air Traffic Monitor' is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "main.h"

int main(int argc, char *argv[])
{
	QKismetApp app(argc,argv);
	return app.exec();
}

QKismetApp::QKismetApp(int &argc,char **argv) : QApplication(argc,argv)
{
	Window = new MainWindow(&Socket);

	
	//Server events

	connect(&Socket,SIGNAL(serverInfo(kismetInfo)),this,SLOT(setServerInfo(kismetInfo)));
	connect(&Socket,SIGNAL(stateCh(QAbstractSocket::SocketState)),Window,SLOT(showState(QAbstractSocket::SocketState)));
	
	connect(this,SIGNAL(aboutToQuit()),&Socket,SLOT(SaveSettings()));
	Socket.Connect();

	Window->show();
}

void QKismetApp::setServerInfo(kismetInfo info)
{
	Window->setSTime(info.stime);
	Window->setServerName(info.name);
}

